﻿using System;
using System.Collections.Generic;
using System.Text;
using Cashier_DAO.db;
using Cashier_DAO;
using System.Data.Common;

namespace Cashier_Service
{
    public class ConfigService
    {
        /// <summary>
        /// 清空数据库表数据
        /// </summary>
        /// <returns></returns>
        public int EmptyTableData()
        {
            int count = 0;
            try
            {
                using (DbConnection conn = ConnectionFactory.GetDbConnection())
                {
                    conn.Open();
                    String[] tables = { "bill_purchase", "bill_purchase_goods", "bill_purchase_payment", "bill_repurchase",
                                      "bill_repurchase_goods","bill_reshipment","bill_reshipment_goods","bill_shipment",
                                      "bill_shipment_goods","bill_shipment_repayment","category","goods","goods_storage",
                                      "member","payments","payments_sort","supplier","warehouse"};
                    count = new ConfigDAO().EmptyTableData(conn, tables);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return count;
        }
    }
}
